package com.example.lastwork.controller;


import com.example.lastwork.common.controller.LogicController;
import com.example.lastwork.dao.ShopItemDao;
import com.example.lastwork.dto.RestDTO;
import com.example.lastwork.entity.ShopItem;
import com.example.lastwork.service.ShopItemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Api(tags = "商店商品服务接口")
@RestController
@RequestMapping("/ShopItemController")
public class ShopItemController extends LogicController<ShopItemService, ShopItemDao, ShopItem, Long> {
    public ShopItemController(@Autowired ShopItemService service){
        super(service);
    }

    @ApiOperation("根据门店编号获取上架商品信息")
    @RequestMapping(value = "/listShopItemByShopId",method = RequestMethod.POST)
    public RestDTO<List<ShopItem>> listShopItemByShopId(@ApiParam("门店编号") Long shopId){
        return RestDTO.success(getService().listShopItemByShopId(shopId));
    }
}
